home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 58 / pcpp58a.iso / extras / quake 3 source / Q3A_ToolSource.exe / Main / light.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-02  |  2.8 KB  |  131 lines

  1.  
  2. #include "cmdlib.h"
  3. #include "mathlib.h"
  4. #include "bspfile.h"
  5. #include "polylib.h"
  6. #include "imagelib.h"
  7. #include "threads.h"
  8. #include "scriplib.h"
  9.  
  10. #include "shaders.h"
  11. #include "mesh.h"
  12.  
  13.  
  14.  
  15. typedef enum
  16. {
  17.     emit_point,
  18.     emit_area,
  19.     emit_spotlight,
  20.     emit_sun
  21. } emittype_t;
  22.  
  23. #define    MAX_LIGHT_EDGES        8
  24. typedef struct light_s
  25. {
  26.     struct light_s *next;
  27.     emittype_t    type;
  28.     struct shaderInfo_s    *si;
  29.  
  30.     vec3_t        origin;
  31.     vec3_t        normal;        // for surfaces, spotlights, and suns
  32.     float        dist;        // plane location along normal
  33.  
  34.     qboolean    linearLight;
  35.     int            photons;
  36.     int            style;
  37.     vec3_t        color;
  38.     float        radiusByDist;    // for spotlights
  39.  
  40.     qboolean    twosided;        // fog lights both sides
  41.  
  42.     winding_t    *w;
  43.     vec3_t        emitColor;        // full out-of-gamut value
  44. } light_t;
  45.  
  46.  
  47. extern    float    lightscale;
  48. extern    float    ambient;
  49. extern    float    maxlight;
  50. extern    float    direct_scale;
  51. extern    float    entity_scale;
  52.  
  53. extern    qboolean    noSurfaces;
  54.  
  55. //===============================================================
  56.  
  57. // light_trace.c
  58.  
  59. // a facet is a subdivided element of a patch aproximation or model
  60. typedef struct cFacet_s {
  61.     float    surface[4];
  62.     int        numBoundaries;        // either 3 or 4, anything less is degenerate
  63.     float    boundaries[4][4];    // positive is outside the bounds
  64.  
  65.     vec3_t    points[4];            // needed for area light subdivision
  66.  
  67.     float    textureMatrix[2][4];    // compute texture coordinates at point of impact for translucency
  68. } cFacet_t;
  69.  
  70. typedef struct {
  71.     vec3_t        mins, maxs;
  72.     vec3_t        origin;
  73.     float        radius;
  74.  
  75.     qboolean    patch;
  76.  
  77.     int            numFacets;
  78.     cFacet_t    *facets;
  79.  
  80.     shaderInfo_t    *shader;        // for translucency
  81. } surfaceTest_t;
  82.  
  83.  
  84. typedef struct {
  85.     vec3_t        filter;                // starts out 1.0, 1.0, 1.0, may be reduced if
  86.                                     // transparent surfaces are crossed
  87.  
  88.     vec3_t        hit;                // the impact point of a completely opaque surface
  89.     float        hitFraction;        // 0 = at start, 1.0 = at end
  90.     qboolean    passSolid;
  91. } trace_t;
  92.  
  93. extern    surfaceTest_t    *surfaceTest[MAX_MAP_DRAW_SURFS];
  94.  
  95. void    InitTrace( void );
  96.  
  97. // traceWork_t is only a parameter to crutch up poor large local allocations on
  98. // winNT and macOS.  It should be allocated in the worker function, but never
  99. // looked at.
  100. typedef struct {
  101.     vec3_t        start, end;
  102.     int            numOpenLeafs;
  103.     int            openLeafNumbers[MAX_MAP_LEAFS];
  104.     trace_t        *trace;
  105.     int            patchshadows;
  106. } traceWork_t;
  107.  
  108. void TraceLine( const vec3_t start, const vec3_t stop, trace_t *trace,
  109.                qboolean testAll, traceWork_t *tw );
  110. qboolean PointInSolid( vec3_t start );
  111.  
  112. //===============================================================
  113.  
  114. //===============================================================
  115.  
  116.  
  117. typedef struct {
  118.     int        textureNum;
  119.     int        x, y, width, height;
  120.  
  121.     // for patches
  122.     qboolean    patch;
  123.     mesh_t        mesh;
  124.  
  125.     // for faces
  126.     vec3_t    origin;
  127.     vec3_t    vecs[3];
  128. } lightmap_t;
  129.  
  130.  
  131.